package com.phkj.qdh.repository

import com.phkj.qdh.bean.MyBaseInspectBean
import com.phkj.qdh.bean.MyBaseInspectDetailBean
import com.phkj.qdh.bean.MyFailoverDetailBean
import com.phkj.qdh.bean.MyFailoverListBean
import com.phkj.qdh.bean.MyLawDetail
import com.phkj.qdh.bean.MyTeamDetail
import com.phkj.qdh.bean.ThreeScoreBean
import com.phkj.qdh.bean.ThreeScoreRecordBean
import com.phkj.qdh.bean.UserCenterBean
import com.phkj.qdh.bean.UserMyNoticeTeamOrLawBean
import com.phkj.qdh.net.BASE_NOTICE_DETAIL
import com.phkj.qdh.net.BASE_NOTICE_EDIT
import com.phkj.qdh.net.BASE_NOTICE_LIST
import com.phkj.qdh.net.BASE_NOTICE_LIST1
import com.phkj.qdh.net.LAW_DETAIL
import com.phkj.qdh.net.LAW_FEEDBACK
import com.phkj.qdh.net.LAW_REFUSE
import com.phkj.qdh.net.MY_FAILEOVER_Detail
import com.phkj.qdh.net.MY_FAILEOVER_LIST
import com.phkj.qdh.net.PageList
import com.phkj.qdh.net.TEAM_DETAIL
import com.phkj.qdh.net.TEAM_FEEDBACK
import com.phkj.qdh.net.TEAM_REFUSE
import com.phkj.qdh.net.THREE_SCORING
import com.phkj.qdh.net.THREE_SCORING_LIST
import com.phkj.qdh.net.USER_CENTER
import com.phkj.qdh.net.USER_MY_NOTICE
import rxhttp3.RxHttp
import rxhttp3.toFlowResponse

object UserRepository {
    fun getThreeScore() = RxHttp.get(THREE_SCORING).toFlowResponse<ThreeScoreBean>()

    fun getThreeScoreList() = RxHttp.get(THREE_SCORING_LIST).toFlowResponse<ArrayList<ThreeScoreRecordBean>>()

    fun getUserCenter() = RxHttp.get(USER_CENTER).toFlowResponse<UserCenterBean>()

    fun getTeamOrLawNotice(map: Map<String, Any?>) =
        RxHttp.get(USER_MY_NOTICE).addAll(map).toFlowResponse<PageList<UserMyNoticeTeamOrLawBean>>()


    fun getBaseNotice(map: Map<String, Any?>) =
        RxHttp.get(BASE_NOTICE_LIST1).addAll(map).toFlowResponse<PageList<MyBaseInspectBean>>()

    fun getTeamDetail(id: Int) =
        RxHttp.get(TEAM_DETAIL).add("problemPoliceId", id).toFlowResponse<MyTeamDetail>()

    fun getBaseDetail(id: Int) =
        RxHttp.get(BASE_NOTICE_DETAIL).add("id", id).toFlowResponse<MyBaseInspectDetailBean>()

    fun editBaseDetail(map: Map<String, Any?>) =
        RxHttp.postJson(BASE_NOTICE_EDIT).addAll(map).toFlowResponse<String>()

    fun teamRefuse(map: Map<String, Any?>) =
        RxHttp.get(TEAM_REFUSE).addAll(map).toFlowResponse<Boolean>()

    fun lawRefuse(map: Map<String, Any?>) =
        RxHttp.get(LAW_REFUSE).addAll(map).toFlowResponse<Boolean>()

    fun getLawDetail(id: Int) =
        RxHttp.get(LAW_DETAIL).add("problemPoliceId", id).toFlowResponse<MyLawDetail>()
    //我的-容错申请
    fun getMyFailoverList(map: Map<String, Any?>) =
        RxHttp.get(MY_FAILEOVER_LIST).addAll(map).toFlowResponse<PageList<MyFailoverListBean>>()

    fun getMyFailoverDetail(id:Int) =
        RxHttp.get(MY_FAILEOVER_Detail).add("id",id).toFlowResponse<MyFailoverDetailBean>()

    fun teamFeedback(map: Map<String, Any?>) =
        RxHttp.postJson(TEAM_FEEDBACK).addAll(map).toFlowResponse<Boolean>()
    fun lawFeedback(map: Map<String, Any?>) =
        RxHttp.postJson(LAW_FEEDBACK).addAll(map).toFlowResponse<Boolean>()
}